<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../assets/js/vue.js"></script>
    <style>
        .text{
            background-color: violet;
            width: 100px;
            height: 50px;
            border-radius: 50%;
        }
    </style>
</head>
<body>
    <div id="app">
        <p ref="DOM">msg:{{ msg }}</p>
        <input type="button" value="msg重新赋值" @click="setMsg()">
        <div class="text">

        </div>
    </div>
    <script>
        vm=new Vue({
            el:"#app",
            data:{
                 msg:"默认消息",   
            },
            methods: {
                setMsg(){
                    console.log(this.$refs.DOM.innerHTML);
                    console.log(this.msg);
                    this.msg=Math.random();
                    console.log(this.$refs.DOM.innerHTML);
                    console.log(this.msg);
                    console.log("==========")
                    Vue.nextTick(()=>{
                        console.log(this.$refs.DOM.innerHTML);
                        console.log(this.msg);
                    })
                    vm.$nextTick(function(){
                        console.log(this.$refs.DOM.innerHTML);
                        console.log(this.msg);
                    })
                },
            },
        })
    </script>
</body>
</html>